package main

import "fmt"

/**
如果要访问结构体成员，需要使用点号 . 操作符，格式为：
结构体.成员名"
结构体类型变量使用 struct 关键字定义，实例如下：
*/
type BooksA struct {
	title   string
	author  string
	subject string
	book_id int
}

func main() {
	var book1 BooksA /* 声明 book1 为 BooksA 类型 */
	var book2 BooksA /* 声明 book2 为 BooksA 类型 */

	/* book 1 描述 */
	book1.title = "Go 语言"
	book1.author = "www.runoob.com"
	book1.subject = "Go 语言教程"
	book1.book_id = 6495407

	/* book 2 描述 */
	book2.title = "Python 教程"
	book2.author = "www.runoob.com"
	book2.subject = "Python 语言教程"
	book2.book_id = 6495700

	/* 打印 book1 信息 */
	fmt.Printf("Book 1 title : %s\n", book1.title)
	fmt.Printf("Book 1 author : %s\n", book1.author)
	fmt.Printf("Book 1 subject : %s\n", book1.subject)
	fmt.Printf("Book 1 book_id : %d\n", book1.book_id)

	/* 打印 book2 信息 */
	fmt.Printf("Book 2 title : %s\n", book2.title)
	fmt.Printf("Book 2 author : %s\n", book2.author)
	fmt.Printf("Book 2 subject : %s\n", book2.subject)
	fmt.Printf("Book 2 book_id : %d\n", book2.book_id)
}
